package DataAccess;

import DataAccess.*;

//////////////////////////////////////////////////////////////////////////
// �� �� ��: CaiZhong.cs
// �� �� ��: BillySir
// ��������: 2006-12-12
// ��    ��: ��װ���ݱ�[CaiZhong]��ز���
// ģ���޸�: 
//     2006-11-17  ֧��ChangePage�ؼ���ֻװ�ص�ǰҳ���ݹ���
//     2006-10-28  ����ͨ��DataRowView���쵥��������
//     2006-10-16  ���뼯�ϲ���foreach/Add/Remove�ȹ���,����Transaction����
// ��    Ȩ: ����ʢ������ó�����޹�˾(c)2006-2007
//////////////////////////////////////////////////////////////////////////
/** 
 Data Access Layer Object Of CaiZhong
*/
public class CaiZhong extends DataAccessBase
{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����ͻ���
	public CaiZhong()
	{
		super();
		_DataRow.setItem("Id", 0);
		_DataRow.setItem("Id2", 0);
		_DataRow.setItem("Name", "");
		_DataRow.setItem("Price", 0);
		_DataRow.setItem("MaxZhuShu", 0);
		_DataRow.setItem("MaxBeiShu", 0);
		_DataRow.setItem("Zt", "");
		_DataRow.setItem("url", "");
	}
	public CaiZhong(DataRow dataRow)
	{
		super(dataRow);
	}
	public CaiZhong(DataRowView dataRowView)
	{
		super(dataRowView);
	}
	@Override
	protected DataRow BuildRow()
	{
		DataTable dt = new DataTable();
		dt.Columns.Add("Id",Integer.class);
		dt.Columns.Add("Id2",Integer.class);
		dt.Columns.Add("Name",String.class);
		dt.Columns.Add("Price",java.math.BigDecimal.class);
		dt.Columns.Add("MaxZhuShu",Integer.class);
		dt.Columns.Add("MaxBeiShu",Integer.class);
		dt.Columns.Add("Zt",String.class);
		dt.Columns.Add("url",String.class);
		return dt.NewRow();
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����ͻ���
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����
	public final DataRow getDataRow()
	{
		return super._DataRow;
	}
	public final int getId()
	{
		return Integer.parseInt(_DataRow.getItem("Id").toString());
	}
	public final void setId(int value)
	{
		_DataRow.setItem("Id", value);
	}
	public final int getId2()
	{
		return Integer.parseInt(_DataRow.getItem("Id2").toString());
	}
	public final void setId2(int value)
	{
		_DataRow.setItem("Id2", value);
	}
	public final String getName()
	{
		return _DataRow.getItem("Name").toString();
	}
	public final void setName(String value)
	{
		_DataRow.setItem("Name", value);
	}
	public final java.math.BigDecimal getPrice()
	{
		return java.math.BigDecimal.Parse(_DataRow.getItem("Price").toString());
	}
	public final void setPrice(java.math.BigDecimal value)
	{
		_DataRow.setItem("Price", value);
	}
	public final int getMaxZhuShu()
	{
		return Integer.parseInt(_DataRow.getItem("MaxZhuShu").toString());
	}
	public final void setMaxZhuShu(int value)
	{
		_DataRow.setItem("MaxZhuShu", value);
	}
	public final int getMaxBeiShu()
	{
		return Integer.parseInt(_DataRow.getItem("MaxBeiShu").toString());
	}
	public final void setMaxBeiShu(int value)
	{
		_DataRow.setItem("MaxBeiShu", value);
	}
	public final String getZt()
	{
		return _DataRow.getItem("Zt").toString();
	}
	public final void setZt(String value)
	{
		_DataRow.setItem("Zt", value);
	}
	public final String geturl()
	{
		return _DataRow.getItem("url").toString();
	}
	public final void seturl(String value)
	{
		_DataRow.setItem("url", value);
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ��������
	protected final boolean DeleteByCondition(String condition)
	{
		String sql = "" + "\r\n" +
"				Delete From CaiZhong" + "\r\n" +
"				WHERE " + condition;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		super.ExecuteSQL(sql);
//#else
		try
		{
			super.ExecuteSQL(sql);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
		return true;
	}
	public final boolean Delete(int Id)
	{
		String condition = "Id=" + String.valueOf(Id);
		return DeleteByCondition(condition);
	}
	public final boolean Delete()
	{
		String condition = "Id=" + String.valueOf(getId());
		return DeleteByCondition(condition);
	}
	public final boolean Insert()
	{
		String sql = "Select SEQ_CaiZhong.nextval From DUAL";
		this.setId((int)super.GetIntValue(sql));
		sql = "" + "\r\n" +
"				Insert Into CaiZhong (" + "\r\n" +
"					Id," + "\r\n" +
"					Id2," + "\r\n" +
"					Name," + "\r\n" +
"					Price," + "\r\n" +
"					MaxZhuShu," + "\r\n" +
"					MaxBeiShu," + "\r\n" +
"					Zt," + "\r\n" +
"					url" + "\r\n" +
"				) Values (" + "\r\n" +
"					" + getId() + "," + "\r\n" +
"					" + getId2() + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getName()) + "," + "\r\n" +
"					" + getPrice() + "," + "\r\n" +
"					" + getMaxZhuShu() + "," + "\r\n" +
"					" + getMaxBeiShu() + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getZt()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(geturl()) + "\r\n" +
"				)";
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		super.ExecuteSQL(sql);
//#else
		try
		{
			super.ExecuteSQL(sql);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
		return true;
	}
	protected final boolean SelectByCondition(String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					Id," + "\r\n" +
"					Id2," + "\r\n" +
"					Name," + "\r\n" +
"					Price," + "\r\n" +
"					MaxZhuShu," + "\r\n" +
"					MaxBeiShu," + "\r\n" +
"					Zt," + "\r\n" +
"					url" + "\r\n" +
"				  From CaiZhong" + "\r\n" +
"				 Where " + condition + "\r\n" +
"			";
		DataTable dt;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		dt = super.GetDataTable(sql);
//#else
		try
		{
			dt = super.GetDataTable(sql);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
		try
		{
			_DataRow = dt.Rows[0];
		}
		catch (java.lang.Exception e2)
		{
			return false;
		}
		return true;
	}
	public final boolean SelectByPk(int Id)
	{
		String condition = "1=1" + "\r\n" +
"				   And Id=" + String.valueOf(Id) + "\r\n" +
"			";
		return SelectByCondition(condition);
	}


	public final boolean SelectByCzID(int czid2)
	{
		String condition = "1=1" + "\r\n" +
"				   And id=" + String.valueOf(czid2) + "\r\n" +
"			";
		return SelectByCondition(condition);
	}
	public final boolean Update()
	{
		String sql = "" + "\r\n" +
"				Update CaiZhong SET" + "\r\n" +
"					Id2=" + getId2() + "," + "\r\n" +
"					Name=" + Helper.ToSQLParamStr(getName()) + "," + "\r\n" +
"					Price=" + getPrice() + "," + "\r\n" +
"					MaxZhuShu=" + getMaxZhuShu() + "," + "\r\n" +
"					MaxBeiShu=" + getMaxBeiShu() + "," + "\r\n" +
"					Zt=" + Helper.ToSQLParamStr(getZt()) + "," + "\r\n" +
"					url=" + Helper.ToSQLParamStr(geturl()) + "\r\n" +
"				Where 1=1" + "\r\n" +
" 				  And Id= " + String.valueOf(getId()) + "\r\n" +
"				";
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		return (super.ExecuteSQL(sql) == 1);
//#else
		try
		{
			return (super.ExecuteSQL(sql) == 1);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
	}

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ��������
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ���淽��

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ���淽��
}